package cn.dlc.com.sys.config.converter;


import org.springframework.core.convert.converter.Converter;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MyDateConverter implements Converter<String, Date> {

	@Override
	public Date convert(String source) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//	    dateFormat.setLenient(false);
	    try {    
	        return dateFormat.parse(source);    
	    } catch (Exception e) {    
	        e.printStackTrace();    
	    }          
	    return null;    
	}
}